import {
  Controller,
  Get,
  Post,
  Body,
  Param,
  Delete,
  Query,
  Put,
  UploadedFile,
  UseInterceptors, ValidationPipe, UsePipes
} from "@nestjs/common";
import { BannerDataService, BannerService } from "./banner.service";
import { CreateBannerDataDto, CreateBannerDto } from "./dto/create-banner.dto";
import { UpdateBannerDataDto, UpdateBannerDto } from "./dto/update-banner.dto";
import { FindBannerDataDTO, FindBannerDTO } from "./dto/find-banner.dto";
import { DeleteIds } from "../dto/all-dto";

@Controller('banner')
export class BannerController {
  constructor(private readonly bannerService: BannerService) {}

  @Post()
  create(@Body() createBannerDto: CreateBannerDto) {
    return this.bannerService.create(createBannerDto);
  }

  @Get()
  findAll(@Query() findBanner:FindBannerDTO) {
    return this.bannerService.findAll(findBanner);
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.bannerService.findOne(+id);
  }

  @Put()
  update(@Body() updateBannerDto: UpdateBannerDto) {
    return this.bannerService.update(updateBannerDto);
  }

  @Delete()
  remove(@Body() deleteIds:DeleteIds) {
    return this.bannerService.remove(deleteIds);
  }
}

@Controller("bannerData")
export class BannerDataController {
  constructor(
    private readonly bannerDataService: BannerDataService,
  ) {}
  @Get()
  findAll(@Query() findDataBanner: FindBannerDataDTO) {
    return this.bannerDataService.findAll(findDataBanner);
  }
  @Post()
  create(@Body() createBannerDataDto: CreateBannerDataDto) {
    return this.bannerDataService.create(createBannerDataDto)
  }

  @Put()
  update(@Body() updateBannerDataDto: UpdateBannerDataDto) {
    return this.bannerDataService.update(updateBannerDataDto)
  }

  @Delete()
  delete(@Body() deleteIds:DeleteIds) {
    return this.bannerDataService.delete(deleteIds)
  }
}
